package com.xiangban.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiangban.dao.InsuranceMapper;
import com.xiangban.model.Insurance;
import com.xiangban.model.dto.InsuranceDto;
import com.xiangban.service.InsuranceService;
import com.xiangban.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/12/29 10:08
 */
@Service
public class InsuranceServiceImpl implements InsuranceService {

    @Autowired
    private InsuranceMapper insuranceMapper;
    @Autowired
    private PageUtil pageUtil;


    @Override
    public PageInfo<InsuranceDto> listInsurancePage(InsuranceDto insuranceDto) {
        PageHelper.startPage(pageUtil.getPage().getPageNum(),pageUtil.getPage().getPageSize());
        List<InsuranceDto> insurances = insuranceMapper.listInsurance(insuranceDto);
        return new PageInfo<>(insurances);
    }
}
